package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.sql.SQLException;

@Controller
public class TestExceptionDBController {
  @Autowired
  private UserService userService;
  
  @RequestMapping({"/queryNotExistDB/{id}"})
  @ResponseBody
  public User selectUserNotExist(@PathVariable String id) throws SQLException {
    User user = this.userService.queryAndUpdateUser_NotExist(id);
    return user;
  }
}